package cn.tedu.controller;

import cn.tedu.pojo.Car;
import cn.tedu.service.CarServiceImple;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

@RestController  //接收前端请求和处理响应
@RequestMapping("car")  //规定了url和类的匹配方式
@CrossOrigin //前后端跨域问题
public class CarController {

    @Autowired   //SpringDI依赖注入的前提需要在调用类的上添加注解:@Component
    private CarServiceImple CarService;

    @RequestMapping("get")  //规定了url和方法的匹配方式
     public Car get()  {


        return CarService.get();  //调用@service返回的数据:CarService.get()
     }
}
